//
//  ActiveTableViewCell.m
//  CarHome
//
//  Created by 张世琦 on 14-9-18.
//  Copyright (c) 2014年 WJN_work@163.com. All rights reserved.
//

#import "ActiveTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation ActiveTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self createImageView];
        [self createCityLabel];
        [self createPepleLabel];
        [self createTimeLabel];
        [self createTitleLabel];
        [self createLabel];
    }
    return self;
}

//自定义cell图片
- (void)createImageView
{
    _car_image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 150)];
    [self.contentView addSubview:_car_image];
    [_car_image release];
}

//Tiele
- (void)createTitleLabel
{
    _title_label = [[UILabel alloc] initWithFrame:CGRectMake(0, 160, 320, 40)];
    [self.contentView addSubview:_title_label];
    [_title_label release];
}

//城市
- (void)createCityLabel
{
    _city_label = [[UILabel alloc] initWithFrame:CGRectMake(10, 210, 100, 20)];
    [_city_label setFont:[UIFont fontWithName:@"Arial" size:13] ];
    [self.contentView addSubview:_city_label];
    [_city_label release];
}

//时间
- (void)createTimeLabel
{
    _time_label = [[UILabel alloc] initWithFrame:CGRectMake(10, 240, 150, 20)];
    [_time_label setFont:[UIFont fontWithName:@"Arial" size:13] ];
    [self.contentView addSubview:_time_label];
    [_time_label release];
}

//人数
- (void)createPepleLabel
{
    _people_label = [[UILabel alloc] initWithFrame:CGRectMake(160, 240, 150, 20)];
    [_people_label setFont:[UIFont fontWithName:@"Arial" size:13] ];
    [_people_label setTextAlignment:NSTextAlignmentRight];
    [self.contentView addSubview:_people_label];
    [_people_label release];
}

- (void)createLabel
{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 260, 320, 10)];
    label.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:0.5];
    [self.contentView addSubview:label];
    [label release];
}

#pragma mark - 
#pragma mark 赋值

- (void)setUrl:(NSString *)url title:(NSString *)title cityName:(NSString *)cityName regenddate:(NSString *)regenddate pcviews:(NSInteger)pcviews
{
    [_car_image sd_setImageWithURL:[NSURL URLWithString:url]];
    [_title_label setText:title];
    [_city_label setText:cityName];
    [_time_label setText:regenddate];
    [_people_label setText:[NSString stringWithFormat:@"%ld%@", (long)pcviews, @"人关注"]];
    
}

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
